package com.example.demo.controller;

import com.example.demo.domain.vo.FindTmnByNameVo;
import com.example.demo.domain.vo.UnbindingVO;
import com.example.demo.service.TerminalService;
import com.h3c.iotframework.annotation.UrlResolver;
import com.h3c.iotframework.common.KongMqResponse;
import com.h3c.iotframework.util.ResultVoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * @author xieluoyin
 */
@Controller
public class ControllerDemo {
    private final
    TerminalService terminalService;

    @Autowired
    public ControllerDemo(TerminalService terminalService) {
        this.terminalService = terminalService;
    }


    /**
     * @param vo 这里只能传入一个vo对象
     * @return 处理后的KongMqResponse对象
     */
    @UrlResolver(url = "/demo", methodType = "post")
    public KongMqResponse demo(UnbindingVO vo) {

        return ResultVoUtil.success("test " + vo);
    }

    /**
     * @param vo 这里只能传入一个vo对象
     * @return 处理后的KongMqResponse对象
     */
    @UrlResolver(url = "/demo", methodType = "get")
    public KongMqResponse demo1(FindTmnByNameVo vo) {

        return ResultVoUtil.success(terminalService.find(vo));
    }
}
